package com.nimitz.web.controller.equipment;

import com.nimitz.common.core.domain.AjaxResult;
import com.nimitz.factorEquipment.domain.Equipment;
import com.nimitz.factorEquipment.domain.FactorEquipment;
import com.nimitz.factorEquipment.service.FactorEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.nimitz.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/smart/factor/equipment")
public class FactoryEquipmentController {
    @Autowired
    private FactorEquipmentService factorEquipmentService;

    @GetMapping
    public List<Equipment> selectEquipmentsByFactorId(Long factorId) {
        return factorEquipmentService.selectEquipmentsByFactorId(factorId);
    }

    // 查看因子设备
    @GetMapping("/list")
    public AjaxResult listFactorEquipment(FactorEquipment factorEquipment) {
        startPage();
        List<FactorEquipment> factorEquipments = factorEquipmentService.getFactorEquipment(factorEquipment);
        return AjaxResult.success(factorEquipments);
    }
}
